<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加角色</title>
    <link rel="stylesheet" th:href="@{/src/css/layui.css}">
</head>
<body>
<form class="layui-form" style="width:80%;" id="arf">
    <!-- 投诉id隐藏域 -->
    <input type="hidden" id="id" name="id" th:value="${complain.id}"/>
    <!--被投诉id-->
    <input type="hidden" id="complain" name="complain" th:value="${complain.complain}"/>
    <div class="layui-form-item">
        <label class="layui-form-label">投诉账户</label>
        <div class="layui-input-block">
            <input type="text" disabled  class="layui-input account" th:value="${complain.account}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">投诉内容</label>
        <div class="layui-input-block">
            <input type="text" disabled class="layui-input content" th:value="${complain.content}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">投诉类型</label>
        <div class="layui-input-block">
            <select disabled  lay-verify="" style="width: 200px">
                <option value="0" th:selected="${complain.complainType == 0}">动态</option>
                <option value="1" th:selected="${complain.complainType == 1}">商品</option>
                <option value="2" th:selected="${complain.complainType == 2}">服务</option>
                <option value="3" th:selected="${complain.complainType == 3}">活动</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">处理回复</label>
        <div class="layui-input-block">
            <textarea placeholder="处理回复"  name="replay" class="layui-input replay"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="pass">提交处理</button>
        </div>
    </div>
</form>
<script th:src="@{/src/layui.js}"></script>
<script th:src="@{/src/js/jquery-1.9.1.min.js}"></script>
<script>

        layui.use(['form','jquery','layer'],function () {
            var form = layui.form,
                $ = layui.jquery,
                layer = layui.layer;
            form.on('submit(pass)',function (data) {
               $.ajax({
                   url:'/complain/pass',
                   data:data.field,
                   type:'put',
                   dataType:'json',
                   success:function (result) {
                       if(result.code == 200){
                           layer.msg('处理成功',{icon:1},function () {
                               top.layer.closeAll('iframe');
                               //重新加载数据
                               parent.location.reload();
                           })
                       }else{
                           layer.msg(result.message,{icon:5});
                       }
                   }
               })

               return false;
            })
        })
</script>
</body>
</html>